In the following lecture you will need the following commands to download and install the Nginx Ingress Controller:

kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/mandatory.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/provider/cloud-generic.yaml

And the following YAML to test an Ingress:

apiVersion: v1
kind: Pod
metadata:
  name: nginx-v1
  labels:
    app: nginx-v1
spec:
  containers:
    - name: nginx-v1
      image: nginx:1.15.9

---

apiVersion: v1
kind: Service
metadata:
  name: nginx-v1-service
spec:
  selector:
    app: nginx-v1
  ports:
    - port: 80

---

apiVersion: v1
kind: Pod
metadata:
  name: nginx-v2
  labels:
    app: nginx-v2
spec:
  containers:
    - name: nginx-v2
      image: nginx:1.15.12

---

apiVersion: v1
kind: Service
metadata:
  name: nginx-v2-service
spec:
  selector:
    app: nginx-v2
  ports:
    - port: 80

---

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: example-ingress
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /$2
spec:
  rules:
  - http:
      paths:
        - path: /v1(/|$)(.*)
          backend:
            serviceName: nginx-v1-service
            servicePort: 80
        - path: /v2(/|$)(.*)
          backend:
            serviceName: nginx-v2-service
            servicePort: 80